﻿
@{
    Layout = null;
}



<!DOCTYPE html>
<html data-use-rem="750">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="format-detection" content="telephone=no, email=no">
    <title>产品三包防伪扫码</title>
    <link rel="stylesheet" href="/Content/ty/reset-h5.css">
    <link rel="stylesheet" href="/Content/ty/index.css">
    <link rel="stylesheet" href="/Content/ty/swiper.css">
    <style>
        .swiper-container img {
            height:auto;
        }
    </style>
</head>

<body>
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <img src="https://api.whtxqp.com/fl/20200804/2001662100.jpg"   class="swiper-slide" />
            <img src="https://api.whtxqp.com/fl/20200804/762686667.jpg"   class="swiper-slide" />
        </div>
        <div class="swiper-pagination"></div>
    </div>
    <div class="bigbox">
        <<div class="input-box">
            <div class="tit">扫码查询</div>
            <div class="saoma" id="scan"></div>
        </div>
        <div class="input-box">
            <div class="tit">输码查询</div>
            <input placeholder="" class="search-input" /><span class="search-btn">查询</span>
        </div>
    </div>
    <div class="fwResult" id="fwresult" style="display: none;"></div>
    <div class="ts-box1">
        <h1>温馨提示:</h1>
        <p>每个防伪码只能正确查询1次，首次查询请消费者注意看清楚查询结果。</p>
    </div>

    <div class="ts-box2">
        <h1>查询方法:</h1>
        <p>1、扫码关注武汉泰祥汽配官方微信公众号。</p>
        <p>
            2、关注后，点击产品防伪中的防伪查询，扫码或手输20位数码，即可查询真伪信息。
        </p>
        <p>3、查询结果与实物信息对比，判别真伪。</p>
        <p>4、原旧版防伪标查询，请刮开涂层，手动输入12位防伪码，只可查询真伪信息（无产品信息）。</p>
    </div>

    <script src="/Content/ty/rem.js"></script>
    <script src="/Content/ty/jquery.min.js"></script>
    <script src="/Content/ty/swiper.min.js"></script>
    
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script>
			var swiper = new Swiper('.swiper-container', {
				pagination: '.swiper-pagination',
				paginationClickable: true,
				spaceBetween: 0,
				centeredSlides: true,
				autoplay: 3000,
				autoplayDisableOnInteraction: false
			});

			wx.config({
				debug: false,
                appId: 'wxc7cfc75d5f0899e2',
				timestamp: '@ViewBag.timestamp',
                nonceStr: '@ViewBag.nonceStr',
                signature: '@ViewBag.signature',
				jsApiList: [
					"scanQRCode"
				]
			});

			var btn = document.getElementById('scan');
			wx.ready(function() {
				// 在这里调用 API
				btn.onclick = function() {
					wx.scanQRCode({
						needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
						scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码
						success: function(res) {
							var result = res.resultStr;
							if(result.indexOf("?") >= 0) {
								result = result.split("?")[1];
							};
							if(result.indexOf("=") >= 0) {
								result = result.split("=")[1];
							};
							query(result);
						}
					});
				}
			});

			$('.search-btn').click(function() {
				var code = $('.search-input').val();
				if(code == "") {
					alert('请输入防伪码');
					return;
				}

				query(code);
			});

			function query(code) {
			 
				jQuery.ajax({
					type: "get",
                    url: "/API/GetCKCate",
                    data: "Code=" + code,
                    contentType: "application/json;charset=UTF-8",
                    success: function (rs)
                    {
                        
                        var json = jQuery.parseJSON(rs);
                        if (json.Status == 100) {
                            $('.fwResult').show();
                            $('.ts-box1').hide();
                            $('.ts-box2').hide();

                            var sortInfo = json.Data.sortInfo;
                            var cateInfo = json.Data.cateInfo;
                            var s = "<br>" + sortInfo.Title + "</br>";                            
                            $('#fwresult').html("<br>" + sortInfo.Title + "</br>");
                        }
                        else
                        {
                            $('.fwResult').show();
                            $('.ts-box1').hide();
                            $('.ts-box2').hide();
                            $('#fwresult').html("您所输入的防伪码" + code+"不存在！请谨防假冒。");
                        }
						
					}
				});

				 
			}
    </script>
</body>

</html>
